//
//  YHHomeMyMachineManagementListSubCell.m
//  YHApp
//
//  Created by -- on 2021/7/19.
//

#import "HAAllMachineListCell.h"
#import "HAAllMachineListMo.h"

@interface HAAllMachineListCell ()

/***/
@property (nonatomic, strong) UIView *mainView;
/***/
@property (nonatomic, strong) UILabel *snLabel;
/***/
@property (nonatomic, strong) UILabel *nameLabel;
/***/
@property (nonatomic, strong) UIImageView *rImgV;

@end

@implementation HAAllMachineListCell

-(void)setModel:(HAAllMachineListMo *)model {
    _model = model;
    
    self.snLabel.text = [NSString stringWithFormat:@"SN:%@",_model.sn];
    self.nameLabel.text = [NSString stringWithFormat:@"型号:%@   政策:%@",_model.name,_model.policyName];
    
}

-(void)layoutSubviews {
    [super layoutSubviews];
    
    
    self.contentView.backgroundColor = [UIColor khaBGColor];
    [self.mainView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.right.mas_equalTo(0);
        make.top.mas_equalTo(0);
        make.bottom.mas_equalTo(-10);
    }];
    
    [self.rImgV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_offset(5);
        make.height.mas_offset(10);
        make.centerY.mas_equalTo(0);
        make.right.mas_equalTo(-20);
    }];
    
    [self.snLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(20);
        make.right.mas_equalTo(self.rImgV.mas_left).offset(-10);
        make.centerY.mas_equalTo(-12);
    }];
    
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(20);
        make.right.mas_equalTo(self.rImgV.mas_left).offset(-10);
        make.centerY.mas_equalTo(12);
    }];


}

- (UIView *)mainView
{
    if (!_mainView) {
        _mainView = [UIView ha_createView];
        _mainView.backgroundColor = [UIColor whiteColor];
        [self.contentView addSubview:_mainView];
    }
    return _mainView;
}

- (UILabel *)snLabel
{
    if (!_snLabel) {
        _snLabel = [UILabel ha_NLabelWithFont:17 textColor:@"#111A34" text:@"" alignment:0];
        [self.mainView addSubview:_snLabel];
    }
    return _snLabel;
}

- (UILabel *)nameLabel
{
    if (!_nameLabel) {
        _nameLabel = [UILabel ha_NLabelWithFont:12 textColor:@"#858B9C" text:@"" alignment:0];
        [self.mainView addSubview:_nameLabel];
    }
    return _nameLabel;
}

- (UIImageView *)rImgV
{
    if (!_rImgV) {
        _rImgV = [UIImageView ha_createImageView];
        _rImgV.image = [UIImage imageNamed:@"ic_cell_more"];
        [self.contentView addSubview:_rImgV];
    }
    return _rImgV;
}


@end
